<?php

namespace App\Imports;

use App\Models\DriverModel;
use App\Models\OrderModel;
use App\Models\SupplierModel;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use stdClass;

class PlanlineImport implements ToCollection, WithMultipleSheets
{

    private $result;

    public function __construct() {
        $this->result = new stdClass;
    }

    public function collection(Collection $rows){
        $lines = [];
        foreach ($rows as $k => $row) {
            $lines[] = $row;
        }

        $this->result->lines = $lines;
    }

    public function sheets(): array {
        return [ 0 => $this];
    }

    public function get_result(){
        return $this->result;
    }


}
